/*
 * @ProjectName: flutter_common
 * @Package: 
 * @ClassName: Audit_router.dart
 * @Description: 审核页面路由
 * @User: Page.Su
 * @Date: 2020/8/28
 * @Time: 12:11
 * @UpdateDate: 2020/8/28 12:11
 */
import 'package:fluro/fluro.dart';
import 'package:fluro/src/router.dart';
import 'package:flutter_su/pages/audit/audit_page.dart';
import 'package:flutter_su/pages/audit/country_list.dart';
import 'package:flutter_su/pages/audit/user_identity.dart';
import 'package:flutter_su/router/base_router.dart';
import 'package:flutter_su/router/fluro_convert_utils.dart';

class AuditRouter with BaseRouter {

  // 国家列表
  static const String _COUNTRY_LIST = "/countryList/:countryCode";
  static const String COUNTRY_LIST = "/countryList";
  // 审核页面
  static const String AUDIT_PAGE = "/auditPage";
  // 选择身份和类型页面
  static const String _TYPE_IDENTITY = "/typeIdentity/:type/:index";
  static const String TYPE_IDENTITY = "/typeIdentity";

  @override
  void initRouter(Router router) {
    // 国家列表
    router.define(
      _COUNTRY_LIST,
      handler: Handler(handlerFunc: (_, params){
        String countryCode = params['countryCode'].first;
        return CountryList(countryCode: countryCode,);
      }),
    );

    // 注册的审核页面
    router.define(
      AUDIT_PAGE,
      handler: Handler(handlerFunc: (_, params) => AuditPage()),
    );

    // 类型和身份
    router.define(
      _TYPE_IDENTITY,
      handler: Handler(handlerFunc: (_, params){
        String type = params['type'].first;
        int index = FluroConvertUtils.string2int(params['index'].first);
        return UserIdentityPage(type: type, index: index,);
      }),
    );

  }

}